/*
 * trace_CmdPathInfo.h
 *
 *  Created on: 2012/07/12
 *      Author: guanxiaoying
 */

#ifndef TRACE_CMDPATHINFO_H_
#define TRACE_CMDPATHINFO_H_
/* line segment between flow-control commands
         ASM_CMD_CHOOSE
		 ASM_CMD_CHOOSEEND
		 ASM_CMD_CONFLUX
		 ASM_CMD_JUMP
		 ASM_CMD_BRANCH
		 ASM_CMD_FUNCENTRY
		 ASM_CMD_FUNCEXIT
 *  Created at the beginning of trace.
 *    ( Tr_CmdTraceAllEntries -> tr_StartCmdList )
 *  Deleted at the end of trace.
 *    ( Tr_CmdTraceAllEntries -> tr_FinishCmdList )
 *
 *  There is not any branch in a path!
 *  A path may have out-path more than one, at most two.
 *		PS: switch-case are converted to if-else if-***- else.
 *  A path may have in-path more than one, no limit.
 *  	For example, label: ***;  goto label; goto label;...
*/
typedef struct _CMDPATHINFOACCESS{
	BOOL (*clear)( VOID );
	BOOL (*alloc)( AST );
	AST  (*getMax)( VOID );
	/* property below: When a path has two out-paths. For the two out-paths,
	 *    one of them has the value PATH_TRUE,
	 *    and the other has the value PATH_FALSE;
	 * For the only one out-paths. Never mind!	 */
	ACCESS_U2_FIELD condition;
	/* property below: traced times. It's used to judge whether this path has been traced. */
	ACCESS_U2_FIELD times;
	/* property below: total traced times.
	 *  Keep increasing when being traced. */
	ACCESS_U2_FIELD totalTimes;
	/* property below: Can go through? TRUE: cannot, FALSE(default) can */
	ACCESS_U2_FIELD whenBroken;
	/* property below: Begin command of this path */
	ACCESS_IDX_FIELD beginNode;
	/* property below: End command of this path */
	ACCESS_IDX_FIELD endNode;
	/* property below: the first Out-path of this path */
	ACCESS_IDX_FIELD pathOut;
	/* property below: the first In-path of this path */
	ACCESS_IDX_FIELD pathIn;
	/* property below: When this path's in-path(pathIn) has two out-paths,
	 *  and this path is the first one,
	 *  record the second one by pathOut_next. */
	ACCESS_IDX_FIELD pathOut_next;
	/* property below: When this path's out-path(pathOut) has more than one out-paths,
	 *  and this path is not the last one,
	 *  record the next one by pathIn_next. */
	ACCESS_IDX_FIELD pathIn_next;
	/* property below: the loop that this path belongs to */
	ACCESS_IDX_FIELD loopInfo;
	ACCESS_IDX_FIELD param;
}CMDPATHINFOACCESS;
extern const CMDPATHINFOACCESS stCmdPathInfoAccess;

#endif /* TRACE_CMDPATHINFO_H_ */
